
import java.io.IOException;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Quang
 */
public class Test {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        FileManager file = new FileManager();
        Boolean stop = false;
        Scanner scanner = new Scanner(System.in);
        int choise;
        System.out.println("Chao mung ban den voi chuong trinh quan ly file, thuc muc");
        do {
            System.out.println("Chon 1 - Copy file");
            System.out.println("Chon 2 - Xoa file/thu muc");
            System.out.println("Chon 3 - Doi ten file/thumuc");
            System.out.println("Chon 4 - Xem file");
            System.out.println("Chon 5 - Nen file");
            System.out.println("Chon 7 - Giai nen file");
            System.out.println("Chon 8 - Thoat");
            choise = scanner.nextInt();
            switch (choise) {
                case 1: {// copy file
                    String pathSource, pathDestination;
                    System.out.println("Nhap File can copy: ");
                    pathSource = scanner.next();
                    
                    System.out.println("Nhap dich den: ");
                    pathDestination = scanner.next();
                    
                    if(file.CopyFile(pathSource, pathDestination))
                        System.out.println("Copy thanh cong");
                    else
                        System.out.println("Copy that bai");
                    
                    break;
                }
                case 2: {// xoa file/thu muc
                    String path;
                    System.out.println("Nhap File/thu muc can xoa");
                    path = scanner.next();
                   file.Delete(path);
                    
                    break;
                }
                case 3: {
                    String path, newName;
                    System.out.println("Nhap thu muc/file can doi ten");
                    path = scanner.next();
                    System.out.println("Nhap ten moi: ");
                    newName = scanner.next();
                    if(file.Rename(path, newName))
                        System.out.println("Doi ten thanh cong");
                    else
                        System.out.println("Ko doi duoc ten");
                    break;
                }
                case 4: {
                    String path;
                    System.out.println("Nhap file can xem");
                    path = scanner.next();
                    if(!file.ViewFile(path)){
                        System.out.printf("Ko xem duoc file %s", path);
                    }
                    else
                        System.out.println();
                    break;
                }
                case 5: {
                    break;
                }
                case 6: {
                    break;
                }
                case 7: {
                    break;
                }
                case 8:{
                    System.out.println("Ban co thuc su mon thoat yes = 1, no = 0");
                    int c = scanner.nextInt();
                    if( c == 1){
                        stop=true; 
                    }
                    else
                        stop=false;
                }
                default: {
                    break;
                }
            }
        } while (!stop);


    }
}
